#include "MCMouseArgs.h"
#include <MCCanvas.h>
#include <MCUtils.h>
#include <iostream>

MCMouseArgs::MCMouseArgs(QMouseEvent *event, MCCanvas *canvas) :
    _event(event),
    _canvas(canvas)
{
    _position = MCPoint2D(event->pos().x(), event->pos().y());
}

MCMouseArgs::~MCMouseArgs()
{
}

MCPoint2D MCMouseArgs::globalPos()
{
    return _canvas->worldToScreen(_position);
}

const MCPoint2D &MCMouseArgs::position()
{
    return _position;
}

double MCMouseArgs::x()
{
    return _position.x;
}

double MCMouseArgs::y()
{
    return _position.y;
}

bool MCMouseArgs::isRightMousePressed()
{
    return _event->button() == Qt::RightButton;
}

bool MCMouseArgs::isLeftMousePressed()
{
    return _event->button() == Qt::LeftButton;
}

bool MCMouseArgs::isMiddleMousePressed()
{
    return _event->button() == Qt::MiddleButton;
}

bool MCMouseArgs::isCtrlPressed()
{
    return _event->modifiers() == Qt::ControlModifier;
}
